package com.genericdevice.platform.core.mvp;

import android.app.Activity;

/**
 * Created by Xilent on 17.05.2014.
 */
public abstract class AbstractView<Presenter extends AbstractPresenter> implements IView<Presenter> {
    protected Activity activity;
    protected Presenter presenter;

    @Override
    public void setActivity(Activity activity) {
        this.activity = activity;
    }

    @Override
    public void setPresenter(Presenter presenter) {
        this.presenter = presenter;
    }

    protected void loadElements() {}

    @Override
    public void init() {}

    @Override
    public void onCreate() {
        activity.setContentView(getViewResource());

        loadElements();
        init();
    }

    @Override
    public void onLoad() {}

    @Override
    public void destroy() {}

    public abstract int getViewResource();
}
